Skip to content

[ECO-5294] Work around Xcode 16.3 compiler crashes#268

Merged
lawrence-forooghian merged 4 commits intomainfrom
266-fix-xcode-16.3-compiler-crash
Apr 14, 2025
Merged

[ECO-5294] Work around Xcode 16.3 compiler crashes#268
lawrence-forooghian merged 4 commits intomainfrom
266-fix-xcode-16.3-compiler-crash

Conversation

@lawrence-forooghian
Copy link
Copy Markdown
Collaborator

@lawrence-forooghian lawrence-forooghian commented Apr 14, 2025

Xcode 16.3 has a few compiler crashes relating to typed throws. Here I work around these crashes. We'll revisit these workarounds in #267.

Resolves #266.

Summary by CodeRabbit

  • Refactor

    • Enhanced error handling and result management in messaging and room operations for a more reliable user experience.
    • Streamlined pagination for smoother data retrieval.
  • Chore

    • Expanded build tooling support by adding compatibility with a newer Xcode version.
  • Bug Fixes

    • Adjusted error handling in pagination to simplify error management and improve functionality.

These are the internal changes; I need to also make one that affects
public API but will do that in a separate commit.

Part of #266.
With this change, the SDK now compiles in Xcode 16.3 without crashing
the compiler.

This is a breaking public API change but we're not at 1.x yet and also I
hope that we can revert it soon, once the referenced compiler crash is
fixed. If it turns out that the compiler crash isn't going to be fixed
any time soon, then we might need to try and find a workaround that
preserves the typed throws (I've already put a bit of time into trying
to find one, but didn't succeed and thought it wasn't worth spending
more time on yet).

Resolves #267.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 14, 2025

Walkthrough

The changes modify error handling in several modules. In ChatAPI.swift and Rooms.swift, methods now return a Result type rather than throwing errors directly. The PaginatedResult.swift file has simplified its error handling by removing explicit error types. Additionally, BuildTool.swift now lists support for Xcode 16.3. These alterations standardize error management across asynchronous operations.

Changes

File(s) Change Summary
Sources/AblyChat/ChatAPI.swift Updated getMessages and makePaginatedRequest methods to wrap responses in a Result type instead of throwing errors directly.
Sources/AblyChat/PaginatedResult.swift Removed explicit ARTErrorInfo from the throws clauses in protocol properties and their implementation in PaginatedResultWrapper.
Sources/AblyChat/Rooms.swift Modified waitForRoom (and its usage in get) to return a Result type, encapsulating room creation success or error instead of using direct throws.
Sources/BuildTool/BuildTool.swift Added a new tooling entry for Xcode version "16.3" alongside the existing "16.2" entry in the build matrix configuration.
.github/workflows/check.yaml Simplified job name for code-coverage, removed dependencies and strategy fields, and fixed the Xcode version to 16.2.

Assessment against linked issues

Objective Addressed Explanation
Fix compiler crash in Xcode 16.3 (#266, ECO-5294)

Possibly related PRs

Suggested reviewers

  • umair-ably
  • maratal

Poem

In a burrow of code, I hopped with glee,
Transforming errors to a Result, you see.
With careful tweaks and a bounce so slight,
Our code sings clearly both day and night.
A rabbit’s nod for changes done right!


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

It tries to upload multiple artifacts with the same name, causing all
but one of the coverage jobs to fail. There's no need to be doing it for
multiple Xcode versions, anyway (the Xcode version doesn't affect the
coverage information).
The Xcode 16.3 Swift compiler has some crashes related to typed throws
(see 10d8f79 and 9b9afb1). Let's make sure we don't accidentally provoke
these crashes.

We can potentially remove this in #267.
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
.github/workflows/check.yaml (1)

142-142: Simplified Job Name for Code Coverage
The job name has been updated to a fixed string "Generate code coverage", removing the dynamic reference to the Xcode version. This simplifies the display, but please verify that you don't lose valuable version context in the build logs if that's needed.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 51a09ad and 31dd3fe.

📒 Files selected for processing (2)
  • .github/workflows/check.yaml (1 hunks)
  • Sources/BuildTool/BuildTool.swift (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Sources/BuildTool/BuildTool.swift
⏰ Context from checks skipped due to timeout of 90000ms (21)
  • GitHub Check: Example app, tvOS (Xcode 16.3)
  • GitHub Check: Example app, iOS (Xcode 16.3)
  • GitHub Check: Example app, macOS (Xcode 16.3)
  • GitHub Check: Xcode, tvOS (Xcode 16.3)
  • GitHub Check: Xcode, release configuration, tvOS (Xcode 16.3)
  • GitHub Check: Xcode, iOS (Xcode 16.3)
  • GitHub Check: Example app, tvOS (Xcode 16.2)
  • GitHub Check: Xcode, macOS (Xcode 16.3)
  • GitHub Check: Xcode, release configuration, iOS (Xcode 16.3)
  • GitHub Check: Example app, iOS (Xcode 16.2)
  • GitHub Check: Example app, macOS (Xcode 16.2)
  • GitHub Check: Xcode, tvOS (Xcode 16.2)
  • GitHub Check: Xcode, release configuration, macOS (Xcode 16.3)
  • GitHub Check: Xcode, iOS (Xcode 16.2)
  • GitHub Check: Xcode, release configuration, tvOS (Xcode 16.2)
  • GitHub Check: Xcode, macOS (Xcode 16.2)
  • GitHub Check: Xcode, release configuration, iOS (Xcode 16.2)
  • GitHub Check: Xcode, release configuration, macOS (Xcode 16.2)
  • GitHub Check: SPM (Xcode 16.3)
  • GitHub Check: SPM (Xcode 16.2)
  • GitHub Check: Generate code coverage
🔇 Additional comments (2)
.github/workflows/check.yaml (2)

149-153: Fixed Xcode Version for Setup Step in Code Coverage
The maxim-lobanov/setup-xcode@v1 step now uses a hardcoded xcode-version: 16.2. This change enforces a consistent version for the code coverage job—which is important when working around Xcode 16.3 compiler crashes—but note that elsewhere (e.g., in BuildTool.swift) support for Xcode 16.3 has been introduced. Please confirm this deliberate choice so the workflow remains consistent with your overall strategy.


141-157: Independent Execution of the Code Coverage Job
The removal of needs and strategy fields for the code-coverage job means it will run independently of the matrix-based build/test jobs. This simplifies the workflow configuration, but please verify that running code coverage separately (and not waiting on other jobs) aligns with the intended CI dependency chain.

@lawrence-forooghian lawrence-forooghian merged commit 43181a8 into main Apr 14, 2025
30 checks passed
@lawrence-forooghian lawrence-forooghian deleted the 266-fix-xcode-16.3-compiler-crash branch April 14, 2025 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Fix compiler crash in Xcode 16.3

2 participants